package br.com.estevam.sisfin.tools;

import java.util.ArrayList;
import java.util.List;

public class MenuItem {

	private String id;

	private String name;

	private List<MenuItem> subItens;
	
	private boolean pagelink;

	public MenuItem(){
		this("root", "root", false);
	}

	public MenuItem(String id, String name, boolean pagelink){
		this.id = id;
		this.name = name;
		subItens = new ArrayList<MenuItem>();	
		this.pagelink = pagelink;
	}

	public void addSubItem(MenuItem subitem){
		subItens.add(subitem);
	}

	public void addSubItem(String id, String name){
		subItens.add(new MenuItem(id, name, false));
	}
	
	public void addSubItemPageLink(String id, String name){
		subItens.add(new MenuItem(id, name, true));
	}
	
	public void addUncheckedSubItem(String id, String name){
		addSubItem(id, name);
	}

	public boolean hasSubItens(){
		return subItens.size() != 0;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public List<MenuItem> getSubItens(){
		return subItens;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isPagelink() {
		return pagelink;
	}

	public void setPagelink(boolean pagelink) {
		this.pagelink = pagelink;
	}
	
}
